package com.wemei.auto.ui.helper.mohsi

import com.squareup.moshi.Types


object MoshiUtils {
    fun toJSONString(any: Any) = MOSHI.adapter(any.javaClass).toJson(any)
    fun <T> parseObject(text: String, clz: Class<T>) = MOSHI.adapter(clz).fromJson(text)
    fun <T> parseArray(text: String, clz: Class<T>) =
        MOSHI.adapter<ArrayList<T>>(Types.newParameterizedType(ArrayList::class.java, clz)).fromJson(text)
}